<template>
	<view class="content">
		
		
		<!-- 空白页 -->
		<empty v-if="orderList.length === 0"></empty>
		
		<!-- 订单列表 -->
		<view  v-else
			class="goods-box-single"
			v-for="(goodsItem, goodsIndex) in orderList" :key="goodsIndex"
			
		> 
		<!-- @click="navTo('/pages/orderdetail/orderdetail?ORDERNUM='+item.ORDERNUM+'&state='+item.ORDERSTATE+'&index='+tabCurrentIndex+'&EXCHANGE='+(item.GROUP == undefined? '0':item.EXCHANGE==undefined ? '2':'1'))" -->
			
			<view class="l-top"  @click="navToDetail(goodsItem)">付款时间:{{goodsItem.PAYDATE}} </view>
			<view class="ll-left" @click="navToDetail(goodsItem)">
				<image class="l-left" :src="img+goodsItem.THUMB" mode="aspectFill" ></image>
				<view class="l-right">
					<text class="l-right-top">{{goodsItem.NAME}}</text>
					<text class="l-right-mid"  >{{goodsItem.SHORTINFO}}  x 1</text>   
					<text class="l-right-down"  >{{goodsItem.AMOUNT}}</text>
				</view>
			</view>
			
			<view class="l-down">
				<text class="l-down">退款金额:{{goodsItem.AMOUNT}}</text>
			</view>
		</view>
	</view>
</template> 

<script>
	
	export default {
		components: {
		},
		data() {
			return {
				orderList:[],
				img:''
			};
		},
		
		onLoad(options){
			this.loadDate()
			this.img = getApp().globalData.imageAddress
		},
		onPullDownRefresh() {
		},
		
		methods: {
			
			//跳转详情页
			navToDetail(item){
				uni.navigateTo({
					url:'/pages/orderdetail/orderdetail?ORDERNUM='+item.ORDERNUM+'&state='+item.ORDERSTATE+'&EXCHANGE=2'
				})
			},
			async loadDate(){
				this.$http.post("/user/freeOrder",{
					SIGNATURE : uni.getStorageSync("SIGNATURE"),
					TOKEN: uni.getStorageSync('userInfo').TOKEN,
				}).then(e=>{
					console.log("********/",e);
					if( e.data.STATE === '0' && e.statusCode === 200){
						uni.hideLoading();
						this.orderList = e.data.OBJECT
						
						
					}else{
						uni.showToast({title:'网络异常，请稍后重试', icon:"none"});
					}
				}).catch(err =>{
					console.log('request fail', err);
				})
			}
			
		},
	}

</script>

<style lang="scss">
	page, .content{
		background: $page-color-base;
		height: 100%;
	}
	.goods-box-single{
		margin-top: 20upx;
		background : #fff;
		padding-left: 25upx;
		border-radius:3%;
		margin-left: 20upx;
		margin-right: 20upx;
		
		.l-top {
			padding-top: 20upx;
			padding-bottom: 10upx;
			border-bottom: 1upx solid #F5F5F5;
			font-size: 35upx;
		}
		.ll-left {
			padding-top: 20upx;
			padding-bottom: 10upx;
			display: flex;
			
			
			.l-left {
				height: 160upx;
				width: 160upx;
			}
			.l-right{
				display: flex;
				flex-direction: column ;
				font-size : 30upx;
				text-align:right;
				margin-top: 20upx;
				margin-left:250upx;
				.l-right-top{
					
				}
				.l-right-mid{
					
				}
				.l-right-down{
					
				}
			}
			
		}
		.l-down {
			padding-top: 20upx;
			border-top: 1upx solid #F5F5F5;
			
			
			padding-bottom: 10upx;
			padding-left: 230upx;
			font-size: 35upx;
			
		}
		
	}
	
</style>
